package pkev.xgrapher.common.entity;


public class BlurredCoordinates extends Coordinates {
    private double blurredRadius;

    public BlurredCoordinates(double x, double y, double blurredRadius)  {
        super(x, y);
        this.blurredRadius = blurredRadius;
    }

    public double getBlurredRadius() {
        return blurredRadius;
    }

    public void setBlurredRadius(double blurredRadius) {
        this.blurredRadius = blurredRadius;
    }

    @Override
    public int hashCode() {
        return super.hashCode() | ((int)blurredRadius << 3);
    }

    @Override
    public boolean equals(Object o) {
        if (super.equals(o)) {
            return true;
        }

        BlurredCoordinates that = (BlurredCoordinates) o;

        double len = Math.sqrt(Math.pow(getX() - that.getX(), 2) + Math.pow(getY() - that.getY(), 2));
        if (len > getBlurredRadius()) {
            return false;
        }else{
            return true;
        }
    }

    @Override
    public String toString() {
        return "BlurredCoordinates{" +
                "x=" + getX() +
                "y=" + getY() +
                "blurredRadius=" + blurredRadius +
                '}';
    }
}
